-
Notifications
You must be signed in to change notification settings - Fork 462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement Actions around wallet and address commands #1682
Conversation
if err := re.Emit(&addressResult{addr.String()}); err != nil { | ||
return err | ||
} | ||
alr.Addresses = append(alr.Addresses, addr.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making an assumption here (and elsewhere in this file) that a node will never have more addresses than we can hold in memory; it makes the test methods nicer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@frrist please include accurate pr descriptions for whats in the pr. doesnt have to be long but should be accurate to orient the reader to what is changing.
commands/address.go
Outdated
@@ -38,6 +38,11 @@ type addressResult struct { | |||
Address string | |||
} | |||
|
|||
// AddressListResult is the result of running the address list command. | |||
type AddressListResult struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more precise to call it what it is, which is addresslsresult
_, err := fmt.Fprintln(w, addr.Address) | ||
return err | ||
cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, addrs *AddressListResult) error { | ||
for _, addr := range addrs.Addresses { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i assume the way commands library works is that if you return an error it errors out even if you have written some output to w?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically. If for some reason we couldn't write to w
halfway through addrs.Addresses
the error would be returned. This doesn't differ much from the previous behaviour, the iteration was just done elsewhere.
commands/address.go
Outdated
} | ||
|
||
// KeyInfoListResult is the resut of running the wallet export command. | ||
type KeyInfoListResult struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then cant you call it what it is, walletexportresult?
@@ -0,0 +1,49 @@ | |||
package fat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mentioned before that you should move fat to tools/ at some point, much more appropriate there. test helpers is for free functions and the like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have heard cases for both sides (keeping it where it is and moving it to tools), will address after completion. Issue here so we don't forget: #1695
|
||
if err := f.RunCmdJSONWithStdin(ctx, nil, &alr, "go-filecoin", "wallet", "import", file.FileName()); err != nil { | ||
return nil, err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment on other PR #1687 (comment)
89477f6
to
78ed933
Compare
closes #1666
Description
This PR implements FAT actions wrappers around the go-filecoin wallet and address commands.